<template>
    <div class="custom-cell" :class="{bd1px: showBorder}">
      <label class="title" :style="{width: labelWidth}">{{title}}</label>
      <div class="content" :class="{pr: !!btnText}" :style="customStyle">{{content}}
        <span class="btn" v-if="!!btnText" @click="$emit('handleCell', id)">{{btnText}}</span>
      </div>
    </div>
</template>
<script>

export default {
  props: {
    id: [String, Number],
    title: String,
    content: String,
    showBorder: {
      type: Boolean,
      default: true
    },
    labelWidth: String,
    // showBtn: {
    //   type: Boolean,
    //   default: false
    // },
    customStyle: {
      type: Object,
      default: () => {}
    },
    btnText: {
      type: String,
      default: ''
    }
  }
}
</script>
<style lang="less" scoped>
  .custom-cell {
    position: relative;
    height: 0.7rem;
    display: flex;
    align-items: center;
    background: #ffffff;
    &.bd1px:after{
      content: " ";
      display: block;
      position: absolute;
      width: 100%;
      bottom: 0;
      height: 1px;
      border-bottom: 1px solid #d2d2d2;
      color: #d2d2d2;
      transform-origin: 0 100%;
      transform: scaleY(0.5);
    }
    .title {
      position: relative;
      width: 1.5rem;
      height: 0.5rem;
      line-height: 0.5rem;
      padding-left: 0.3rem;
      padding-right: 0.1rem;
      font-size: 0.26rem;
      color: #333333;
      text-align: justify;
      box-sizing: border-box;
      overflow: hidden;
      // white-space: nowrap;
      // text-overflow: ellipsis;
      &::after {
        display:inline-block;
        content:'';
        overflow:hidden;
        width:100%;
        height:0;
      }
      &::before {
        display: block;
        position: absolute;
        right: 0;
        // top: 50%;
        // margin-top: -50%;
        content:':';
        overflow:hidden;
      }
    }
    .content {
      flex: 1;
      width: 100%;
      // height: 0.7rem;
      // line-height: 0.7rem;
      padding-left: 0.16rem;
      font-size: 0.26rem;
      color: rgba(42, 42, 42, 0.8);
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      &.pr {
        position: relative;
        line-height: 0.5rem;
        padding-right: 1.62rem;
      }
      .btn {
        position: absolute;
        right: 0.2rem;
        display: inline-block;
        width: 1.42rem;
        height: 0.5rem;
        line-height: 0.5rem;
        background: #D44743;
        font-size: 0.26rem;
        color: #FFFFFF;
        text-align: center;
        letter-spacing: 0.006rem;
        border-radius: 0.06rem;
      }
    }
  }
</style>
